package com.yzy.fly.loader;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yzy.fly.entity.role.FlyAttribute;
import com.yzy.fly.entity.role.FlyModel;
import com.yzy.fly.kernel.controller.LoaderConfig;
import com.yzy.fly.kernel.model.FlyBasicModel;
import com.yzy.fly.kernel.model.FlyKey;
import com.yzy.fly.kernel.service.FlyBasicService;
import com.yzy.fly.kernel.service.FlyCrudService;
import com.yzy.fly.mapper.FlyAttributeMapper;
import com.yzy.fly.mapper.FlyModelMapper;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * 模型加载器
 */
@Data
public class FlyRoleLoader<K extends Serializable, M extends FlyBasicModel> {

    private boolean roleRootClass;
    private boolean parentModelSave;
    private boolean parentModelDelete;
    private boolean mExistCheck;
    private Map<String,Object> globalVariables;
    private Class<? extends FlyBasicModel>[] filters = new Class[]{};

    private FlyCrudService<K,M> flyBasicService;

    public List<FlyModel> build() {
        return null;
    }

    public M loaderById(M m,boolean lazy) throws Exception{
//        Class<? extends FlyBasicModel>[] filters = new Class[]{};
        return flyBasicService.loaderByModel(m, new LoaderConfig());
    }



}
